
<?php $nav_users = 'active'; ?>
@extends('admin.layouts.base')
@section('title','产品列表')
@section('pageHeader','产品列表')

@section('content')
    <div class="row">
        <div class="col-xs-12">
            <div class="box">
                <div class="box-header">
                    <h3 class="box-title">前台用户管理</h3><span style="float: right;"><a href="{{ url('/admin/qian/index') }}" class="btn btn-info">重置</a></span>
                </div>

                <form action="{{ url('/admin/qian/excel') }}" method="get" class="form-inline">
                    <div class="form-group"></div>
                    <div class="form-group">
                        <label for="date">选择日期</label>
                        <input type="text"  placeholder="请选择日期" id="test10" name="time"  style="width:300px">

                    </div>
                    <button type="submit" class="btn btn-purple btn-sm">
                        <span class="ace-icon fa fa-search icon-on-right bigger-110"></span>
                        导出excel
                    </button>
                    <p style="float:right;margin-right:10%" > 搜索:
                        <input type="number" name="userphone" placeholder="搜索手机号" value="{{ Request::input('userphone') }}" max="11"/>
                        <input type="text"  placeholder="请选择日期" id="test10" name="timeSearch"  style="width:300px">

                        <span  onclick="search()"  class="glyphicon glyphicon-search"></span>

                    </p>

                </form>
                <div class="box-footer">

                    <table id="data-table" class="table table-striped">
                        <thead>
                        <tr>
                            <td>#</td>
                            <td>姓名</td>
                            <td>手机号</td>
                            <td>注册时间</td>
                        </tr>
                        </thead>
                        <tbody>
                        @foreach($data as $index => $item)
                            <tr>
                                <td class="ids">{{$item -> id}}</td>
                                <td>{{$item->name }}</td>
                                <td>{{ $item->userphone }}</td>
                                <td>{{ $item->registe_time }}</td>
                            </tr>
                        @endforeach
                        </tbody>
                    </table>

                        <div class="pull-right">
                            @if( \Illuminate\Support\Facades\Auth::user()['id'] == 1)
                                <a href="{{ url('/admin/qian/create') }}">
                                    <button class="btn btn-primary btn-sm">添加用户</button>
                                </a>
                            @endif
                        </div>
                </div>
            {!! $data->appends(['userphone' => Request::input('userphone',''),'time' => Request::input('time',''),'class' => Request::input('class','')])->render()!!}
            <!-- /.box-body -->
            </div>
            <!-- /.box -->
        </div>
        <!-- /.col -->
    </div>
    <!-- /.row -->
@endsection

<script src=" {{ asset("/laydate/laydate.js") }} "></script>

<script>

    laydate.render({
        elem: '#test10', //指定元素
        type: 'datetime',
        range: '-',
        format: 'yyyy/MM/dd HH:mm:ss'
    });


    window.onload = function()
    {
        $.ajaxSetup({
            headers:{
                'X-CSRF-TOKEN':$('meta[name="csrf-token"]').attr('content')
            }
        });

        setInterval(function(){
            $("#jg").fadeOut(1000);
        }, 3000);

    }

    //通过手机号搜索
    function search()
    {
        var userphone = $('input[name="userphone"]').val();
        var time      = $('input[name="timeSearch"]').val();

        window.location.href = '/admin/qian/search?userphone=' + userphone  +'&time=' + time;

    }


    function sequencing(e){
        var userphone = $('input[name="userphone"]').val();
        var nickname  = $('input[name="nickname"]').val();
        var time      = $('input[name="time"]').val();
        var sequencing = e.id;


        window.location.href = '/admin/search?userphone=' + userphone + '&nickname=' + nickname +'&time=' + time + '&sequencing=' +sequencing + '&class=' + e.classList[1];
    }
</script>
